<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title></title>
	<script type="text/javascript" src="../foryou/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="tween.js"></script>
	<script type="text/javascript">
		$(function(){
			function _run($target, params) {
				
				var timeHandler,t=0,p = params;
				function move() {
					t++;
					var values = {};
					
					if(p.type == 'x') {
						$target.css({left:p.bx});
						values = {
							left:p.funcX(t,p.bx,p.cx,p.d)+'px',
						}
					} else if(p.type == 'y') {
						$target.css({left:p.by});
						$target.css({left:(visible_width-width)/2,top:visible_height-height});
						values = {
							top:p.funcY(t,p.by,p.cy,p.d)+'px'
						}
					} else if(p.type == 'double') {
						$target.css({left:p.bx,top:p.by});
						values = {
							left:p.funcX(t,p.bx,p.cx,p.d)+'px',
							top:p.funcY(t,p.by,p.cy,p.d)+'px'
						}
					}
					$target.css(values);
					if(t>p.d) {
						clearTimeout(timeHandler);
					} else {
						timeHandler = setTimeout(move,10);
					}
				}
				move();
			}
		
			function _move() {
			
				var 
			
			
			}
		
		
		var visible_width = $(window).innerWidth();// document.body.clientWidth;
		var visible_height =  $(window).innerHeight();
	
		var $pet = $('#pet'),
		width = $pet.width(),
		height = $pet.height();
		
	//	$pet.css({left:(visible_width-width)/2,top:visible_height-height});
		
		
			
		
		_run($pet,{
			bx:0,
			cx: visible_width-width,
			by:0,
			cy: visible_height-height,
			funcX : Tween.Quad.easeIn,
		//	funcY : Tween.Quad.easeOut,
			d:50,
			type:'x' //x,y,double
		});
		
		var $pet2 = $('#pet2'),
		width2 = $pet2.width(),
		height2 = $pet2.height();
		
		_move($pet2, {
			bx:0,
			cx: visible_width-width2,
			by:0,
			cy: visible_height-height2,
			funcX : Tween.Quad.easeIn,
		//	funcY : Tween.Quad.easeOut,
			d:50,
			type:'x' //x,y,double
		});
	});
	
	
	
	</script>
</head>
<body bgcolor="rgb(234,229,209)">
	<div id="pet" style="width:100px;height:100px;position:absolute;background-color:#FFF"></div>
	<div id="pet2" style="width:100px;height:100px;position:absolute;top:100px;background-color:#FFF"></div>
</body>
</html>